//在此处使用promise进行请求的二次封装
import config from './config'

export default function request({
  url,
  data = {},
  method = 'GET'
}) {
  // 解构对应的数据值 并赋初始值
  return new Promise((resolve, reject) => {
    wx.request({
      url: config.baseUrl + url,
      data,
      method,
      header: {
        cookie: 'MUSIC_U=000F1150DCE8B0717B1BD4D8A27F7AF0C50AFA80FCF4B56881EE6F93A029E7E473B9C6FF33DBBE6A98B2D03B4B810CA94FAABA7E0B9E2E4C44F7378E9B3286060725929DDDFD35D5898D8FE615171040009D5CBF7D8A4241E1AA5DF475E9E1B77CC1F2723D64AFC43FFA7C251BF4851B097DF2D5ABABDA1BCCECFD24B6610BDAD930605AF16387DB44C3C54093D6603C3999B43BF38D6BAD51DA8E2B00E40D98562807F5CCEE7131CED17BDC7C7ED62DA6722C755C595D7C0D1D748A99DB5C586585F1AC7DD79BA6126B1544A43DA48A02C37EC066FE99CFAB2DD0585B3FA2D72DF61BBE7EE3EFA11489E9D9425F7BC3DC10E3290478595D2009EA718AC3524F6FD577E044FFE5BB954F0B3E136F9C60A53D606FF85CD2029EE17E7AE54AED774DFF663D3B9B6E9E259398B25570A82D4A8A0178F2FA1BFEEC6D24325855A8A76324FC46CCD1D8639FA6650412A7823C79'
      },
      success: res => {
        resolve(res.data)
      },
      fail: err => {
        reject(err)
      }
    })
  })
}

request({
  url: '/banner'
})